package com.test.nnooolwdeaer.activity_fragment_wooden;

import android.os.Bundle;

import com.test.nnooolwdeaer.constant_wooden.Constant_wooden;
import com.test.nnooolwdeaer.util_wooden.StringUtil_wooden;
import com.test.nnooolwdeaer.util_wooden.http_wooden.HttpManager_wooden;
import com.test.nnooolwdeaer.R;
import com.test.nnooolwdeaer.activity_fragment_wooden.base_wooden.BaseActivity_wooden;
import com.test.nnooolwdeaer.activity_fragment_wooden.base_wooden.BaseApplication_wooden;
import com.test.nnooolwdeaer.activity_fragment_wooden.login_wooden.LoginPhoneNumActivity_wooden;
import com.test.nnooolwdeaer.util_wooden.analytics_wooden.util_wooden.AnalyticsUtil_wooden;

public class MainActivity_wooden extends BaseActivity_wooden {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_wooden);
        init_wooden();
    }

    private void init_wooden() {

        findViewById(R.id.activity_main_tv_login).setOnClickListener(v -> HttpManager_wooden.getInstance_wooden().queryGlobal_wooden());

        StringUtil_wooden.parseAddress_wooden(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
        //获取global配置
        HttpManager_wooden.getInstance_wooden().queryGlobal_wooden();
    }

    //查询Global配置信息响应
    public void onGlobalResponse_wooden() {
        //每次启动，等全局配置接口返回成功后，初始化分析模块
        try {
            AnalyticsUtil_wooden.INSTANCE.init(BaseApplication_wooden.getApplication());
        } catch (Exception e) {
            if (Constant_wooden.Debug) e.printStackTrace();
        }

        //跳转登录页
        startActivityForSingleTop_wooden(LoginPhoneNumActivity_wooden.class);
    }
}